package com.bjsxt.controller;


import com.bjsxt.pojo.HostAddResult;
import com.bjsxt.pojo.HostPower;
import com.bjsxt.service.IHostPowerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2021-10-14
 */
@Controller
@RequestMapping("/hostPower")
public class HostPowerController {
    @Autowired
    private IHostPowerService hostPowerService;
    //处理权限的更新
    @ResponseBody
    @RequestMapping("hostPowerOper")
    public HostAddResult hostPowerOper(HostPower hostPower){
        //处理请求
            //更新
        if(hostPower.getHpid()!=null){
            boolean b = hostPower.updateById();
            return new HostAddResult(b,"更新成功");
        }else{
            //新增
//            QueryWrapper queryWrapper = new QueryWrapper();
//            queryWrapper.eq();
//            Host host1 = this.host.selectOne();
            boolean insert = hostPower.insert();
            return new HostAddResult(insert,"新增成功");
        }
    }

    @ResponseBody
    @RequestMapping("hostPowerBatchOper")
    public HostAddResult hostPowerBatchOper(String hostids,HostPower hostPower){
        //处理请求
        HostAddResult result = hostPowerService.delInsHostPowerBatchService(hostids,hostPower);
            //获取要进行批量设置的主持人ID
        String[]hids = hostids.split(",");
        //删除当前主持人的权限信息



        return result;
    }

}

